package com.it.zhangjun.controller;

import lombok.Data;

import java.io.Serializable;

/**
 * 返回结果信息
 *
 * @author: z00018123
 * @date: 2021/5/8
 **/
@Data
public class Result<T> implements Serializable {
    /**
     * 结果编码
     * 1：成功
     * 其他：失败
     */
    private int code;

    /**
     * 异常信息
     */
    private String errorMessage;

    /**
     * 实体信息
     */
    private T data;

    public Result(int code, String errorMessage, T data) {
        this.code = code;
        this.errorMessage = errorMessage;
        this.data = data;
    }

    public Result(T data) {
        this(1, null, data);
    }
}
